package com.mz.ozy.mvp.presenter;

import android.content.Context;

import com.mz.ozy.base.BasePresenterImpl;
import com.mz.ozy.bean.GoodsListBean;
import com.mz.ozy.mvp.model.ObShopListModel;
import com.mz.ozy.mvp.view.ObShopListContract;
import com.mz.ozy.net.MyObserver;
import com.mz.ozy.utils.RxUtil;

import okhttp3.ResponseBody;

public class ObShopListPresenter extends BasePresenterImpl<ObShopListContract.View> implements ObShopListContract.Presenter {

    private ObShopListModel mModel;

    public ObShopListPresenter() {
        mModel = new ObShopListModel();
    }

    @Override
    public void getList(Context context, String pageSize) {
        mModel.getList(context, pageSize)
                .compose(RxUtil.rxSchedulerHelper(mView.<ResponseBody>bindToLifecycle()))
                .subscribe(new MyObserver<GoodsListBean>(mView) {

                    @Override
                    public void onSuccesss(GoodsListBean jsonObject) {
                        mView.getListSuccess(jsonObject);
                    }
                });
    }
}
